//
//  HeaderAnimationView.swift
//  Swift30Days
//
//  Created by licheng ke on 2017/3/12.
//  Copyright © 2017年 licheng ke. All rights reserved.
//

import UIKit

class HeaderAnimationView: UIView {

    @IBOutlet var Labels: [UILabel]!
    
    var transforR = CGAffineTransform(rotationAngle: CGFloat(M_PI_4))
    
    func animationStart(){
        
        var index = 0.0
        
        for label in Labels {
            UIView.animate(withDuration: 0.8, delay: index * 0.2 , options: .curveLinear, animations: {
                label.transform = self.transforR
                index += 1;
            }, completion: { (flag) in
                if flag {
                    UIView.animate(withDuration: 0.5, animations: { 
                        label.transform = CGAffineTransform.identity
                    }, completion: nil)
                }
            })
        }
        
    }
    
    
    
}
